package com.aabte.design.principle.liskowSubstitution.quadrangle;

/**
 * 长方型和正方型案例不符合里氏替换原则
 */
public class Test {

    public static void resize(Rectangle rectangle){
        while (rectangle.getWidth() <= rectangle.getLength()){
            rectangle.setWidth(rectangle.getWidth()+1);
            System.out.println("width: "+ rectangle.getWidth() + " length: " + rectangle.getLength());
        }
        System.out.println("resize方法结束 width: "+ rectangle.getWidth() + " length: " + rectangle.getLength());

    }

    public static void main(String[] args) {
        // Rectangle rectangle = new Rectangle();
        // rectangle.setWidth(10);
        // rectangle.setLength(20);
        // resize(rectangle);

        // Square square = new Square();
        // square.setLength(10);
        // resize(square);

    }
}
